package com.zabra.zl.ui.index_fragment.money;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.androidkun.xtablayout.XTabLayout;
import com.zabra.zl.R;
import com.zabra.zl.TabAdapter;
import com.zabra.zl.base.BaseActivity;
import com.zabra.zl.base.BaseFragment;
import com.zabra.zl.base.BaseMvpFragment;
import com.zabra.zl.ui.index_fragment.money.fragment.FragmentDay;
import com.zabra.zl.ui.index_fragment.money.fragment.FragmentFree;
import com.zabra.zl.ui.index_fragment.money.fragment.FragmentMonth;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

public class MoneyFragment extends BaseFragment {

    @BindView(R.id.tab)
    XTabLayout tab;
    @BindView(R.id.viewpage)
    ViewPager viewpage;

    private List<String> titleList;
    private List<Fragment> fragmentList;

    @Override
    protected void initView(View view) {
        titleList = new ArrayList<>();
        titleList.add("免息配资");
        titleList.add("按日配资");
        titleList.add("按月配资");
        fragmentList = new ArrayList<>();
        fragmentList.add(new FragmentFree());
        fragmentList.add(new FragmentDay());
        fragmentList.add(new FragmentMonth());

        viewpage.setAdapter(new TabAdapter(getActivity().getSupportFragmentManager(), titleList, fragmentList));
        viewpage.setOffscreenPageLimit(3);
        tab.setupWithViewPager(viewpage);
        tab.getTabAt(0).select();
        viewpage.setCurrentItem(0);
    }

    @Override
    public int getLayoutId() {
        return R.layout.fragment_money;
    }

}
